package com.gabejeff.manager;

import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;

public class InputManager extends KeyAdapter {
	
	private int input;

	public int getInput() {
		int command = -1;
		if (this.input != -1) {
			command = input;
			input = -1;
		}
		return command;
	}
	
    public void keyPressed(KeyEvent evt) {  
        final int key = evt.getKeyCode();
        if (key == KeyEvent.VK_DOWN ||
        	key == KeyEvent.VK_UP ||
        	key == KeyEvent.VK_LEFT ||
        	key == KeyEvent.VK_RIGHT ||
        	key == KeyEvent.VK_SPACE ||
        	key == KeyEvent.VK_ESCAPE ||
        	key == KeyEvent.VK_ENTER) {
        	
        	this.input = key;
        	
        } else {
        	System.out.println(key);
        }
    }
    
}
